export function setItem(key: string, value: any) {
  if (typeof value == "object") {
    value = JSON.stringify(value);
  }
  localStorage.setItem(key, value);
}

export function getItem<T>(key: string, isJSONObj?: boolean): string | null | T {
  let value = localStorage.getItem(key);
  if (isJSONObj && value) {
    value = JSON.parse(value);
  }
  return value;
}

export function removeItem(key: string) {
  localStorage.removeItem(key);
}
